<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>币拍</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="css/global.css" media="all">
    <link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
</head>
<body>
<div class="layui-container" style="width: 80%">
    <form class="layui-form">
        <div class="layui-row" style="margin-top: 50px">
            <fieldset class="layui-elem-field" style="margin-top: 20px">
                <legend style="font-weight: bold;font-size: 40px">转账</legend>
                <div class="layui-col-md12" style="font-size: 30px">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label" style="width:300px">
                                转账给：
                            </label>
                            <div class="layui-input-inline" style="width: 300px;">
                                <input name="to_user" class="layui-input" placeholder="请填写用户名">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label" style="width:300px">
                                金额：
                            </label>
                            <div class="layui-input-inline" style="width: 300px;">
                                <input name="to_user" class="layui-input">
                            </div>
                        </div>
                    </div>
                </div>
            </fieldset>
        </div>
        <button id="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="transfor" style="width: 10%; position: absolute;left: 35%">立即提交</button>
    </form>
</div>
<script type="text/javascript" src="./js/config.js"></script>
<script type="text/javascript" src="plugins/layui/layui.js"></script>
<script type="text/javascript">
    layui.use(['table','form','element','layer'],function () {
        var $ = layui.$;
        var table = layui.table;
        var form = layui.form;
        var layer = layui.layer;
        var element = layui.element;

        form.on('submit(transfor)', function(data){
            console.log(data.field);
            $.ajax({
                url: contextPath+"/transfor",
                type: "POST",
                contentType:"application/json;charset=utf-8",
                data: JSON.stringify(data.field) ,
                dataType:"json",
                success: function(res) {
                    layer.msg(res.message,{
                        icon: 1,
                        time: 1000 //2秒关闭（如果不配置，默认是3秒）
                    } );
                }
            });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
    });
</script>
</body>
</html>